<%@ page language="java" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/jsp/pub/include.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>后台管理--<c:choose><c:when test="${empty clazzEntity}">发布课程</c:when><c:otherwise>编辑课程</c:otherwise></c:choose></title>
<link href="<%=request.getContextPath() %>/css/admin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function trim(str){
	return str.replace(/^\s+|\s+$/,"");
}
function check(form){
    if(trim(form.name.value)==""){
        alert("课程名不能为空");
        return false;
    }

	if(form.industryId.value==0){
		alert("您还未选择行业");
		return false;
	}
    if(rim(form.img.value)=="" ){
        alert("价格为空");
        return false;
    }
    if(rim(form.openTime.value)=="" ){
        alert("开放时间为空");
        return false;
    }
//	if(trim(form.intro.value)==""){
//		alert("介绍不能为空");
//		return false;
//	}
	if(trim(form.img.value)==""){
		alert("封面图不能为空");
		return false;
	}

	<c:if test="${not empty clazzEntity}">
		form.action="<c:url value="/admin/clazzadd?m=doedit"/>";
	</c:if>
	return true;
}
function changeselect(){
//    var industryId= $("#industryId").val();
//    alert(industryId);
}
</script>
</head>
<body>
<div class="content">
<jsp:include page="../pub/top.jsp"></jsp:include>
<!--头部结束-->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="left" valign="top">
<jsp:include page="../pub/left_clazz.jsp"></jsp:include>
</td>
<td valign="top">
	<div class="right">
	<form action="<c:url value="/admin/clazzadd?m=dopub"/>" method="post" onsubmit="return check(this)" enctype="multipart/form-data" style="margin:0">
	<table width="80%" border="0" cellpadding="0" cellspacing="1" bgcolor="#d1d5d8">
	<tr>
	<td height="28" colspan="2" bgcolor="#c6dbf8" class="biaoti" style="padding:0;">
	<c:choose>
		<c:when test="${empty clazzEntity}">添加课程</c:when>
		<c:otherwise>课程编辑</c:otherwise>
	</c:choose>
	</td>
	</tr>

	<tr>
	<td width="15%" height="28" align="right" bgcolor="#edf1f7"><span>*</span>课程名：</td>
	<td height="28" bgcolor="#FFFFFF"><input type="text" name="name" id="name" size="60" value="${clazzEntity.name}" maxlength="25"/><p>请输入课程名称</p></td>
	</tr>
        <tr>
            <td width="15%" height="28" align="right" bgcolor="#edf1f7"><span>*</span>所属行业：</td>
            <td height="28" bgcolor="#FFFFFF">
                <select id="industryId" name="industryId" style="width:100px;" onchange="changeselect()">
                    <option value="0">选择行业</option>
                    <c:forEach items="${industryList}" var="industry">
                        <option value="${industry.name}" ${industry.name==param.industryId?'selected=selected':''}><c:out value="${industry.value}"/></option>
                    </c:forEach>
                </select>

                <p>选择所属行业（从业科目）</p>
            </td>
        </tr>
        <tr>
            <td width="15%" height="28" align="right" bgcolor="#edf1f7">描述：</td>
            <td height="28" bgcolor="#FFFFFF">
                <textarea name="intro"><c:out value="${clazzEntity.intro}" escapeXml="false"/></textarea>
                <p>请输入描述信息</p></td>
        </tr>

        <tr>
            <td width="15%" height="28" align="right" bgcolor="#edf1f7"><span>*</span>价格：</td>
            <td height="28" bgcolor="#FFFFFF"><input type="number" name="price" min="1" id="price" value="${clazzEntity.price}"/><p>请输入课程价格<span>(*以分为单位）</span></p></td>
        </tr>
        <tr>
            <td width="15%" height="28" align="right" bgcolor="#edf1f7"><span>*</span>开放时间：</td>
            <td height="28" bgcolor="#FFFFFF"><input type="text" id="openTime" name="openTime" value="${clazzEntity.openTime}" maxlength="20" placeholder="请选择"  readonly/><p><input type="button" onClick="jeDate({dateCell:'#openTime',isTime:true,format:'YYYY-MM-DD hh:mm:ss'})" value="选择时间"></p></td>
        </tr>
        <tr>
            <td width="15%" height="28" align="right" bgcolor="#edf1f7">活动价格<span>(未开放)</span>：</td>
            <td height="28" bgcolor="#FFFFFF"><input type="text" name="disprice" id="disprice" size="60" value="${clazzEntity.disprice}" maxlength="25"/><p>请输入课程价格（以分为单位）</p></td>
        </tr>
        <tr>
            <td width="15%" height="28" align="right" bgcolor="#edf1f7">活动开始时间<span>(未开放)</span>：</td>
            <td height="28" bgcolor="#FFFFFF"><input type="text" id="startTime" name="startTime" value="${clazzEntity.startTime}" maxlength="20" placeholder="请选择"  readonly/><p><input type="button" onClick="jeDate({dateCell:'#startTime',isTime:true,format:'YYYY-MM-DD hh:mm:ss'})" value="选择时间"></p></td>
        </tr>
        <tr>
            <td width="15%" height="28" align="right" bgcolor="#edf1f7">活动结束时间<span>(未开放)</span>：</td>
            <td height="28" bgcolor="#FFFFFF"><input type="text" id="endTime" name="endTime" value="${clazzEntity.startTime}" maxlength="20" placeholder="请选择"  readonly/><p><input type="button" onClick="jeDate({dateCell:'#endTime',isTime:true,format:'YYYY-MM-DD hh:mm:ss'})" value="选择时间"></p></td>
        </tr>
	<tr>
	<td width="15%" height="28" align="right" bgcolor="#edf1f7"><span>*</span>封面图片：</td>
	<td height="28" bgcolor="#FFFFFF">
		<input type="file" name="img" id="img"/>
		<p>请上传封面图片,只能为jpg,png格式的图片</p></td>
	</tr>

	</table>
	<div class="anniu">
	<p><input type="submit" value="提交" class="fabu" /> 
		<c:choose>
			<c:when test="${empty clazzEntity}"><input type="reset" value="重置" class="fabu" /></c:when>
			<c:otherwise><input type="button" value="返回" class="fabu" onclick="history.back()" /></c:otherwise>
		</c:choose>
	</p>
	<input type="hidden" name="id" value="${clazzEntity.id}"/>
	</div>
	</form>
	</div>
	<br />
	<br />
</td>
</tr>
</table>
<jsp:include page="../pub/foot.jsp"></jsp:include>
</div>

<script type="text/javascript" src="<%=request.getContextPath() %>/fckeditor/fckeditor.js"></script>
<script type="text/javascript">
    var oFCKeditor = new FCKeditor('intro') ;
    oFCKeditor.BasePath	= "${pageContext.request.contextPath}/fckeditor/";
    oFCKeditor.Width="500";
    oFCKeditor.Height="150";
    oFCKeditor.Value="&nbsp;&nbsp;&nbsp;&nbsp;";
    oFCKeditor.ToolbarSet="classnet";
    oFCKeditor.Config["CustomConfigurationsPath"]="${pageContext.request.contextPath}/fckeditor/myconfig.js?d="+new Date().getTime();
    oFCKeditor.ReplaceTextarea();
</script>


</body>
</html>
